package com.xinsoft.entity.dto;

import cn.hutool.core.util.ObjectUtil;
import com.xinsoft.entity.po.MesBom;
import lombok.Data;

import java.math.BigDecimal;

/**
 * @author: π
 * 发货通知
 * */
@Data
public class BomHeadDto {

    // 单据明细
    private String   FInterId;      //主表主键
    private String  FCustID;     //客户编码:"
    private String  FBomType;     //BOM单类型:"
    private String  FBOMNumber;   //编码
    private String  FImpMode;     //数据引入模式:"
    private String  FParentID;     //BOM单组别:"
    private String  FUnitID;     //单     位:"
    private String  FVersion;     //版    本:"
    private String  FUseStatus;     //状    态:"
    private String  FItemID;     //物料代码："
    private String  FAuxPropID;     //辅助属性:"
    private String  FRoutingID;     //工艺路线:"
    private String  FAuxQty;     //数    量:"
    private String  FYield;     //成品率(%):"
    private String  FNote;     //备    注:"
    private String  FCheckerID;     //审核人员:"
    private String  FCheckID;     //建立人员:"
    private String  FAudDate;     //审核日期:"
    private String  FCheckDate;     //建立日期:"
    private String  FOperatorID;     //最后更新人员:"
    private String  FEntertime;     //最后更新日期:"
    private String  FPDMImportDate;     //PDM导入时间:"
    private String  FBOMSkip;     //跳    层:"
    private String  FHeadSelfZ0132;     //计划金额:"
    private String  FHeadSelfZ0136;     //荔湾仓"
    private String  FHeadSelfZ0137;     //双击显示商品图片:"
    private String  FHeadSelfZ0138;     //电镀前:"
    private String  FHeadSelfZ0139;     //电镀后:"
    private String  FHeadSelfZ0140;     //镶钻:"
    private String  FHeadSelfZ0141;     //包装:"
    private String  FHeadSelfZ0142;     //工时合计:"
    private String  FHeadSelfZ0143;     //工价:"
    private String  FHeadSelfZ0144;     //电镀费:"
    private String  FHeadSelfZ0145;     //包装费:"
    private String  FHeadSelfZ0146;     //电镀要求:"
    private String  FHeadSelfZ0147;     //费用金额:"




//    "BillHead": {\
//        r\ n "FBrNo": "0",
//				\r\ n "FInterID": "2071",
//				\r\ n "FBOMNumber": "BOM202207011",
//				\r\ n "FImpMode": "0",
//				\r\ n "FUseStatus": "1073",
//				\r\ n "FVersion": "000",
//				\r\ n "FParentID": "1039",
//				\r\ n "FItemID": "10830",
//				\r\ n "FQty": "1.0000000000",
//				\r\ n "FYield": "100.0000000000",
//				\r\ n "FCheckID": "16407",
//				\r\ n "FCheckDate": "7/22/2022 12:00:00 AM",
//				\r\ n "FOperatorID": "16407",
//				\r\ n "FEnterTime": "7/22/2022 12:00:00 AM",
//				\r\ n "FStatus": "1",
//				\r\ n "FCancellation": "False",
//				\r\ n "FTranType": "50",
//				\r\ n "FRoutingID": "0",
//				\r\ n "FBomType": "0",
//				\r\ n "FCustID": "0",
//				\r\ n "FCustItemID": "0",
//				\r\ n "FAccessories": "0",
//				\r\ n "FNote": "",
//				\r\ n "FUnitID": "1413",
//				\r\ n "FAUXQTY": "1.0000000000",
//				\r\ n "FCheckerID": "16407",
//				\r\ n "FAudDate": "7/22/2022 12:00:00 AM",
//				\r\ n "FEcnInterID": "0",
//				\r\ n "FBeenChecked": "True",
//				\r\ n "FForbid": "0",
//				\r\ n "FAuxPropID": "0",
//				\r\ n "FPDMImportDate": "",
//				\r\ n "FBOMSkip": "1059",
//				\r\ n "FClassTypeID": "1002522",
//				\r\ n "FPrintCount": "0",
//				\r\ n "FUserID": "16407",
//				\r\ n "FUseDate": "7/22/2022 12:00:00 AM"\
//        r\ n
//    }

    public static MesBom voToPo(BomHeadDto vo) {
        if (vo == null) {
            return null;
        }
        MesBom mesBom = new MesBom();
        mesBom.setId(new Integer(vo.getFInterId()));
        mesBom.setBomNo(vo.getFBOMNumber());
        mesBom.setBomName(vo.getFBOMNumber());
        mesBom.setBomVersion(vo.getFVersion());
        mesBom.setMaterialId(ObjectUtil.isEmpty(vo.getFItemID()) ? null : new Long(vo.getFItemID()));
        BigDecimal count = ObjectUtil.isEmpty(vo.getFAuxQty()) ? BigDecimal.ZERO : new BigDecimal(vo.getFAuxQty());
        mesBom.setProduceNum(count);
        mesBom.setAuditId(ObjectUtil.isEmpty(vo.getFCheckerID()) ? null : new Integer(vo.getFCheckerID()));
        mesBom.setRemarks(vo.getFNote());
        mesBom.setAuditStatus(ObjectUtil.isEmpty(vo.getFAudDate()) ? 0 : 1);
        return mesBom;
    }

}
